var AnalysisReport = {
    processInterval:null,
    recentFiveYearImgData: "",
    recentYearImgData: "",
    recentYearUpEntityData: "",
    recentYearUpLocData: "",
    recentYearRatioData: "",
    recentYearUseTimeData: "",
    in10DaysReportedLocDataTop5Img: "",
    over10DaysNotReportedLocDataTop5Img: "",
    notReportedLocDataTop5Img: "",
    recentQuarterImgData: "",
    recentQuarterUpEntityData: "",
    recentQuarterUpLocData: "",
    recentQuarterRatioData: "",
    recentQuarterUseTimeData: "",
    isRedis:false
};

$(function () {

    //科室
    $('#depart').combobox({
        data:$.parseJSON($("#departMap").val()),
        valueField:'value',
        textField:'text'
    });
    //院区
    $('#office').combobox({
        data:$.parseJSON($("#officeMap").val()),
        valueField:'value',
        textField:'text',
        defaultFilter: 6,
        onSelect:AnalysisReport.officeChange,
        onLoadSuccess: function () {
            var hospId = $('#hospitalId').val();
            if (hospId != "") {
                $(this).combobox("setValue", hospId);
                $(this).combobox('disable');
            } else {
                //加载完成后,val[0]写死设置选中第一项
                var val = $(this).combobox("getData");
                if (val.length == 2) {//如果就一个院区 加上全部=2
                    $(this).combobox("setValue", val[1].value);
                    AnalysisReport.officeChange(val[1]);
                } else {
                    $(this).combobox("setValue", "");
                }
            }
        }
    });


    //报告类型下拉框初始化
    $('#reportType').combobox({
        data:[{value:"4",text:"季报"},{value:"3",text:"年报"}],
        valueField:'value',
        textField:'text',
        panelHeight:'auto',
        editable:false,
        onSelect:AnalysisReport.reportTypeChange,
        onLoadSuccess:function () {
            $(this).combobox("select", "4");
        }
    });

    //年度下拉框初始化
    $("#yearChoose").combobox({
        valueField:'year',
        textField:'year',
        panelHeight:'auto'
    });
    var year = [];//创建年度数组
    var startYear;//起始年份
    var thisYear=new Date().getUTCFullYear();//今年
    var endYear=thisYear;//结束年份
    //数组添加值（去年年-今年)-根据情况自己修改
    for(startYear=endYear-2;startYear<=endYear;startYear++){
        year.push({"year":startYear});
    }
    $("#yearChoose").combobox("loadData", year);//下拉框加载数据
    $("#yearChoose").combobox("setValue",thisYear-1);//设置默认值为去年

    //月度下拉框初始化
    $("#monthChoose").combobox({
        valueField:'month',
        textField:'month',
        panelHeight:'200'
    });
    var month = [];//创建月份数组
    var startMonth=1;//起始月份
    var thisMonth=new Date().getUTCMonth()+1;//本月
    //数组添加值（1-12月）为固定值
    for(startMonth;startMonth<13;startMonth++){
        month.push({"month":startMonth});
    }
    $("#monthChoose").combobox("loadData", month);//下拉框加载数据
    $("#monthChoose").combobox("setValue",thisMonth);//设置默认值为本月

    // $('.yearTr').hide();
    $('.monthTr').hide();

    //季度数组
    var quarter = [{"quarter":1,"text":"第一季度"},{"quarter":2,"text":"第二季度"},{"quarter":3,"text":"第三季度"},{"quarter":4,"text":"第四季度"}];
    $("#quarterChoose").combobox({
        valueField:'quarter',
        textField:'text',
        panelHeight:'200'
    });
    $("#quarterChoose").combobox("loadData", quarter);//下拉框加载数据
    $("#quarterChoose").combobox("setValue",1);//

    // $('.quarterTr').hide();
    //默认一星期
    $('.hisui-datebox').datebox({});    //重新渲染datebox -不渲染图标左右间距不等
    var startOpt = $("#startDate").datebox('options');
    startOpt.onSelect = AnalysisReport.startDateSelect;
    startOpt.minDate = nowYear+"-01-01"; //'2020-01-01';
    startOpt.maxDate = startOpt.formatter(now); //'2020-05-20';
    var endOpt = $("#endDate").datebox('options');
    endOpt.onSelect = AnalysisReport.endDateSelect;
    endOpt.minDate = nowYear+"-01-01"; //'2020-01-01';
    endOpt.maxDate = endOpt.formatter(now); //'2020-05-20';
    var startDate = now.getTime()-(1000 * 60 * 60 * 24*6);
    var endDate = now.getTime();
    if(startDate< new Date(startOpt.minDate).getTime()){
        $('#startDate').datebox('setValue', startOpt.minDate);
    } else {
        $('#startDate').datebox('setValue', timeStamp2String(startDate));
    }
    $('#endDate').datebox('setValue', timeStamp2String(endDate));
    $('#processbar').progressbar({
        value: 0
    });
    //获取评估按钮的长度
    var btnWidth = $("#report").width();
    $("#processbar").width(btnWidth);
    $(".progressbar-text").width(btnWidth);
});

AnalysisReport.report = function(){
    var reportType = $('#reportType').combobox('getValue');//报告类型
    var startDate = "";//开始日期
    var endDate = "";//结束日期
    var nowYear = new Date().getUTCFullYear();
    var long6Month = Date.parse(nowYear+"-06-30 00:00:00");//当前年6月31号毫秒数
    var tableYear = ""; //转存历史表后缀
    var quarter = "";
    var office = $("#office").combobox("getValue");
    var depart = $("#depart").combobox("getValue");

    switch (reportType) {
        case "1":
            startDate = $('#startDate').datebox('getValue');//开始日期
            endDate = $('#endDate').datebox('getValue');//结束日期
            if(startDate==""||endDate==""){
                Sys.info("请选择对应日期！")
                return ;
            }
            startDate = startDate + " 00:00:00";
            endDate = endDate + " 23:59:59";
            break;
        case "2":
            var year = $('#yearChoose').datebox('getValue');//年份
            var month = $('#monthChoose').datebox('getValue');//月份
            if(year==""||month==""){
                Sys.info("请选择年份或月份！")
                return ;
            }
            if(year==new Date().getUTCFullYear() && month >= new Date().getUTCMonth()+1)
            {
                Sys.info("请选择本月之前月份~")
                return ;
            }

            if(nowYear==year){
                tableYear = "";
            } else if(nowYear-year==1){
                if(now.getTime()<long6Month){
                    tableYear = "";
                } else {
                    tableYear = "_"+year;
                }
            } else if(nowYear-year>1){
                tableYear = "_"+year;
            }
            if(month<10){month = "0"+month;}
            startDate = year + "-" + month + "-01 00:00:00";
            endDate = year+'-'+month+'-'+new Date(year,month,0).getDate() + " 23:59:59";
            break;
        case "3":
            var year = $('#yearChoose').datebox('getValue');//年份
            if(year==""){
                Sys.info("请选择年份！")
                return ;
            }
            if(year>=new Date().getUTCFullYear())
            {
                Sys.info("请选择本年度之前年份~")
                return ;
            }
            if(nowYear==year){
                tableYear = "";
            } else if(nowYear-year==1){
                if(now.getTime()<long6Month){
                    tableYear = "";
                } else {
                    tableYear = "_"+year;
                }
            } else if(nowYear-year>1){
                tableYear = "_"+year;
            }
            startDate = year + "-01-01 00:00:00";
            endDate = year + "-12-31 23:59:59";

            // 获取年度图片数据
            AnalysisReport.getImgDataByRedis(reportType, startDate, endDate, tableYear, quarter, office, depart);
            break;
        case "4":
            var year = $('#yearChoose').datebox('getValue');//年份
            quarter = $('#quarterChoose').datebox('getValue');//季度
            if(year==""||quarter==""){
                Sys.info("请选择年份或季度！")
                return ;
            }

            if(nowYear==year){
                tableYear = "";
            } else if(nowYear-year==1){
                if(now.getTime()<long6Month){
                    tableYear = "";
                } else {
                    tableYear = "_"+year;
                }
            } else if(nowYear-year>1){
                tableYear = "_"+year;
            }
            if(quarter==1){
                startDate = year + "-01-01 00:00:00";
                endDate = year+"-03-31 23:59:59";
            }else if(quarter==2){
                startDate = year + "-04-01 00:00:00";
                endDate = year+"-06-30 23:59:59";
            }else if(quarter==3){
                startDate = year + "-07-01 00:00:00";
                endDate = year+"-09-30 23:59:59";
            }else if(quarter==4){
                startDate = year + "-10-01 00:00:00";
                endDate = year+"-12-31 23:59:59";
            }

            // 获取季度图片数据
            AnalysisReport.getImgDataByRedis(reportType, startDate, endDate, tableYear, quarter, office, depart);
            break;
        default:
            break;
    }

    //$('#processbar').progressbar('setValue', 0);
    Sys.loading("分析报告生成中,请耐心等待");
    var ajax = new $ax(Sys.backendPath + "/analysis/creatReport", function (data) {
        //开启定时器
        //AnalysisReport.processInterval = setInterval(AnalysisReport.process, 1000);
        window.location.href = Sys.backendPath + "/analysis/downFile/"+data.message;
        Sys.closeLoading();
    }, function (data) {
        Sys.error("报告导出错误!");
    });
    ajax.set({reportType:reportType, startDate: startDate, endDate:endDate, tableYear:tableYear,quarter:quarter,office:office,depart:depart, isRedis:AnalysisReport.isRedis});
    switch (reportType) {
        case "1":
            break;
        case "2":
            break;
        case "3":
            ajax.set({recentFiveYearImg:AnalysisReport.recentFiveYearImgData,recentYearImg:AnalysisReport.recentYearImgData,
                recentYearUpEntityImg:AnalysisReport.recentYearUpEntityData,recentYearUpLocImg:AnalysisReport.recentYearUpLocData,
                recentYearRatioImg:AnalysisReport.recentYearRatioData,recentYearUseTimeImg:AnalysisReport.recentYearUseTimeData,
                in10DaysReportedLocDataTop5Img:AnalysisReport.in10DaysReportedLocDataTop5Img,
                over10DaysNotReportedLocDataTop5Img:AnalysisReport.over10DaysNotReportedLocDataTop5Img,
                notReportedLocDataTop5Img:AnalysisReport.notReportedLocDataTop5Img})
            break;
        case "4":
            ajax.set({recentQuarterImg:AnalysisReport.recentQuarterImgData,
                recentQuarterUpEntityImg:AnalysisReport.recentQuarterUpEntityData,recentQuarterUpLocImg:AnalysisReport.recentQuarterUpLocData,
                recentQuarterRatioImg:AnalysisReport.recentQuarterRatioData,recentQuarterUseTimeImg:AnalysisReport.recentQuarterUseTimeData,
                in10DaysReportedLocDataTop5Img:AnalysisReport.in10DaysReportedLocDataTop5Img,
                over10DaysNotReportedLocDataTop5Img:AnalysisReport.over10DaysNotReportedLocDataTop5Img,
                notReportedLocDataTop5Img:AnalysisReport.notReportedLocDataTop5Img})
    }
    ajax.setAsync(true);
    ajax.start();
}

AnalysisReport.process = function(){
    //{"code":200,"message":"操作成功","v":100,"i":"done"}
    var ajaxProcess = new $ax(Sys.backendPath + "/analysis/getExportProcess", function(data){
        $('#processbar').progressbar('setValue', data.v);
        //刷新进度条
        if(data.v==100){
            clearInterval(AnalysisReport.processInterval);
        }
    },function(data){
        Sys.error("获取进度出错!" + data.responseJSON.message + "!");
    });
    ajaxProcess.setAsync(true);
    ajaxProcess.start();
}

/**
 * 报告类型改变时
 */
AnalysisReport.reportTypeChange  = function (item){

    switch (item.value) {
        case "1":
            $('.yearTr').hide();
            $('.monthTr').hide();
            $(".weekTr").show();
            $(".quarterTr").hide();
            //默认一星期
            $('#startDate').datebox('setValue', timeStamp2String(now.getTime()-(1000 * 60 * 60 * 24*6)));
            $('#endDate').datebox('setValue', timeStamp2String(now.getTime()));
            break;
        case "2":
            $('.yearTr').show();
            $('.monthTr').show();
            $(".weekTr").hide();
            $(".quarterTr").hide();
            if (now.getUTCMonth()==0) {
                $("#yearChoose").combobox("setValue",now.getUTCFullYear()-1);//设置默认值为今年
                $("#monthChoose").combobox("setValue",12);//设置默认值为上月
            } else {
                $("#yearChoose").combobox("setValue",now.getUTCFullYear());//设置默认值为今年
                $("#monthChoose").combobox("setValue",now.getUTCMonth());//设置默认值为上月
            }
            break;
        case "3":
            $('.yearTr').show();
            $('.monthTr').hide();
            $(".weekTr").hide();
            $(".quarterTr").hide();
            $("#yearChoose").combobox("setValue",now.getUTCFullYear()-1);//设置默认值为去年
            break;
        case "4":
            $('.yearTr').show();
            $('.monthTr').hide();
            $(".weekTr").hide();
            $(".quarterTr").show();
            break;
        default:
            break;
    }

    $('#processbar').progressbar('setValue', 0);
}
/**
 * 日期选择时：
 * 开始日期选中，结束日期自动选择6天后
 * 如果结束日期大于最大可选日期，那么结束日期设置为最大可选日期
 */
AnalysisReport.startDateSelect = function (startDate) {
    date = new Date(startDate);
    date.setDate(date.getDate()+6);
    var endDate = date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate();
    var maxDate = $('#endDate').datebox('options').maxDate;
    if(new Date(endDate)>new Date(maxDate)){
        $('#endDate').datebox("setValue", maxDate);
    } else {
        $('#endDate').datebox("setValue", endDate);
    }
}
/**
 * 日期选择时：
 * 结束日期选中，开始日期自动选择6天前
 * 如果最小可选日期大于开始日期，那么开始日期设置为最小可选日期
 */
AnalysisReport.endDateSelect = function (endDate) {
    var date = new Date(endDate);
    date.setDate(date.getDate()-6);
    var startDate = date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate();
    var minDate = $('#startDate').datebox('options').minDate;
    if(new Date(minDate)>new Date(startDate)){
        $('#startDate').datebox("setValue", minDate);
    } else {
        $('#startDate').datebox("setValue", startDate);
    }
}

AnalysisReport.officeChange = function(that){
    var ajax = new $ax(Sys.backendPath + "/sds/common/deptListByHospId", function(data){
        $('#depart').combobox({
            data:data,
            valueField:'value',
            textField:'text',
            defaultFilter: 6,
            onLoadSuccess: function () { //加载完成后,val[0]写死设置选中第一项
                $(this).combobox("setValue", "");
            }
        });
    },function(data){
        layer.msg("查询失败!" + data.responseJSON.message + "!",{icon: 2});
    });
    ajax.set({"hospID":that.value,"id":"depart"});
    ajax.start();
}

/**
 * 在Jquery里格式化Date日期时间数据
 */
function timeStamp2String(time){
    var datetime = new Date();
    datetime.setTime(time);
    var year = datetime.getFullYear();
    var month = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth() + 1) : datetime.getMonth() + 1;
    var date = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate();
    return year + "-" + month + "-" + date;
}

AnalysisReport.getQuarterImgData = function(reportType, startDate, endDate, tableYear, quarter, office, depart){
    var params = {};
    var ajax = new $ax(Sys.backendPath + "/analysis/selectQuarterImgData", function (data) {
        //本季度各月份上报情况
        var recentQuarterImg = data.recentQuarterImg;
        var xdata2 = [];
        var ydata2 = [];
        for (let i in recentQuarterImg) {
            xdata2.push(i);
            ydata2.push(recentQuarterImg[i]);
        }
        var myChart2 = echarts.init(document.getElementById('recentQuarterImg'));
        // 指定图表的配置项和数据
        var option2 = {
            animation:false,//去延迟加载，解决导出只有点的问题
            title: {
                text: '近一年上报情况'
            },
            tooltip: {},
            legend: {},
            xAxis: {
                data: xdata2,
                axisLine: {
                    lineStyle: {}
                }
            },
            yAxis: {},
            series: [
                {
                    name: '例数',
                    type: 'line',
                    smooth: true,
                    showAllSymbol: true,
                    symbol: 'emptyCircle',
                    symbolSize: 15,
                    itemStyle: {
                        normal: {
                            color: function (params) {
                                var index = params.dataIndex
                                //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                                var colorList = ['#5470C6', '#FAC858', '#91CC75', '#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622'];
                                if (params.dataIndex >= colorList.length) {
                                    index = params.dataIndex - colorList.length;
                                }
                                return colorList[index]
                            }
                        }
                    },
                    data: ydata2,
                    markLine: {
                        data: [{type: 'average', name: '月均上报'}]
                    }
                },

            ]
        };
        myChart2.setOption(option2);
        AnalysisReport.recentQuarterImgData = myChart2.getDataURL();
        //病种上报情况
        var recentQuarterUpEntity = data.recentQuarterUpEntity;
        var datalen3 = recentQuarterUpEntity.length
        var dataobj3 = []
        for (var i = 0; i < datalen3; i++) {
            var row = recentQuarterUpEntity[i]
            var tobj = new Object()
            tobj.value = row.count
            tobj.name = row.code
            dataobj3.push(tobj)
        }
        // 按照value值进行降序排序
        dataobj3.sort(function(a, b) {
            return b.value - a.value;
        });
        dataobj3=dataobj3.slice(0,10);
        var xdata3 = [], ydata3 = []
        dataobj3.forEach(function (item, index) {
            xdata3.push(item.name);
            ydata3.push(item.value);
        });
        var myChart3 = echarts.init(document.getElementById('recentQuarterUpEntity'));
        // 指定图表的配置项和数据
        var option3 = {
            title: {
                text: '病种上报情况',
                left: 'center'
            },
            tooltip: {},
            legend: {},
            xAxis: {
                type: 'category',
                data: xdata3
            },
            yAxis: {
                max: 'dataMax'
            },
            series: [
                {
                    type: 'bar',
                    data: ydata3,
                    barMaxWidth: '40px',
                    itemStyle: {
                        normal: {
                            color: function (params) {
                                var index = params.dataIndex
                                //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                                var colorList = ['#5470C6', '#FAC858', '#91CC75', '#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622'];
                                if (params.dataIndex >= colorList.length) {
                                    index = params.dataIndex - colorList.length;
                                }
                                return colorList[index]
                            }
                        }
                    },
                }
            ]
        };
        myChart3.setOption(option3);
        AnalysisReport.recentQuarterUpEntityData = myChart3.getDataURL();
        //科室上报
        var recentQuarterUpLoc = data.recentQuarterUpLoc
        var datalen4 = recentQuarterUpLoc.length
        var dataobj4 = []
        for (var i = 0; i < datalen4; i++) {
            var row = recentQuarterUpLoc[i]
            var tobj = new Object()
            tobj.value = row.count
            tobj.name = row.description
            dataobj4.push(tobj)
        }
        // 按照value值进行降序排序
        dataobj4.sort(function(a, b) {
            return b.value - a.value;
        });
        dataobj4 = dataobj4.slice(0, 10);
        var xdata4 = []
        var ydata4 = []
        dataobj4.forEach(function (item, index) {
            xdata4.push(item.name);
            ydata4.push(item.value);
        });
        var myChart4 = echarts.init(document.getElementById('recentQuarterUpLoc'));
        var option4 = {
            color: ['#2EB7BD', '#3CE1D9', '#FBBACB', '#4695D1'],
            title: {
                text: '科室上报情况',
                left: 'center'
            },
            tooltip: {},
            legend: {},
            xAxis: {
                type: 'category',
                data: xdata4
            },
            yAxis: {
                type: 'value',
                splitLine: {
                    show: true,
                    lineStyle: {
                        color: '#cccccc'
                    }
                }
            },
            series: [{
                name: "",
                type: "bar",
                itemStyle: {
                    normal: {
                        color: function (params) {
                            var index = params.dataIndex
                            //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                            var colorList = ['#5470C6', '#FAC858', '#91CC75', '#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622'];
                            if (params.dataIndex >= colorList.length) {
                                index = params.dataIndex - colorList.length;
                            }
                            return colorList[index]
                        }
                    }
                },
                data: ydata4
            }]
        };
        myChart4.setOption(option4);
        AnalysisReport.recentQuarterUpLocData = myChart4.getDataURL();
        //科室10日内填报率
        var recentQuarterLocIndex = data.recentQuarterLocIndex
        var datalen4_1 = recentQuarterLocIndex.length
        var dataobj4_1 = []
        for (var i = 0; i < datalen4_1; i++) {
            var row = recentQuarterLocIndex[i]
            var tobj = new Object()
            tobj.value = row.in10DaysReportedRate
            tobj.name = row.locName
            dataobj4_1.push(tobj)
        }
        // 按照value值进行降序排序
        dataobj4_1.sort(function(a, b) {
            return b.value - a.value;
        });
        dataobj4_1 = dataobj4_1.slice(0, 10);
        var xdata4_1 = []
        var ydata4_1 = []
        dataobj4_1.forEach(function (item, index) {
            xdata4_1.push(item.name);
            ydata4_1.push(item.value);
        });
        var myChart4_1 = echarts.init(document.getElementById('in10DaysReportedLocDataTop5Img'));
        var option4_1 = {
            color: ['#2EB7BD', '#3CE1D9', '#FBBACB', '#4695D1'],
            title: {
                text: '科室10日填报率情况',
                left: 'center'
            },
            tooltip: {},
            legend: {},
            xAxis: {
                type: 'category',
                data: xdata4_1
            },
            yAxis: {
                name: '%',
                type: 'value',
                splitLine: {
                    show: true,
                    lineStyle: {
                        color: '#cccccc'
                    }
                }
            },
            series: [{
                name: "",
                type: "bar",
                itemStyle: {
                    normal: {
                        color: function (params) {
                            var index = params.dataIndex
                            //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                            var colorList = ['#5470C6', '#FAC858', '#91CC75', '#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622'];
                            if (params.dataIndex >= colorList.length) {
                                index = params.dataIndex - colorList.length;
                            }
                            return colorList[index]
                        }
                    }
                },
                data: ydata4_1
            }]
        };
        myChart4_1.setOption(option4_1);
        AnalysisReport.in10DaysReportedLocDataTop5Img = myChart4_1.getDataURL();
        //科室超10日未填报率
        var recentQuarterLocIndex = data.recentQuarterLocIndex
        var datalen4_2 = recentQuarterLocIndex.length
        var dataobj4_2 = []
        for (var i = 0; i < datalen4_2; i++) {
            var row = recentQuarterLocIndex[i]
            var tobj = new Object()
            tobj.value = row.over10DaysNotReportedRate
            tobj.name = row.locName
            dataobj4_2.push(tobj)
        }
        // 按照value值进行降序排序
        dataobj4_2.sort(function(a, b) {
            return b.value - a.value;
        });
        dataobj4_2 = dataobj4_2.slice(0, 10);
        var xdata4_2 = []
        var ydata4_2 = []
        dataobj4_2.forEach(function (item, index) {
            xdata4_2.push(item.name);
            ydata4_2.push(item.value);
        });
        var myChart4_2 = echarts.init(document.getElementById('over10DaysNotReportedLocDataTop5Img'));
        var option4_2 = {
            color: ['#2EB7BD', '#3CE1D9', '#FBBACB', '#4695D1'],
            title: {
                text: '科室超10日未填报率情况',
                left: 'center'
            },
            tooltip: {},
            legend: {},
            xAxis: {
                type: 'category',
                data: xdata4_2
            },
            yAxis: {
                name: '%',
                type: 'value',
                splitLine: {
                    show: true,
                    lineStyle: {
                        color: '#cccccc'
                    }
                }
            },
            series: [{
                name: "",
                type: "bar",
                itemStyle: {
                    normal: {
                        color: function (params) {
                            var index = params.dataIndex
                            //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                            var colorList = ['#5470C6', '#FAC858', '#91CC75', '#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622'];
                            if (params.dataIndex >= colorList.length) {
                                index = params.dataIndex - colorList.length;
                            }
                            return colorList[index]
                        }
                    }
                },
                data: ydata4_2
            }]
        };
        myChart4_2.setOption(option4_2);
        AnalysisReport.over10DaysNotReportedLocDataTop5Img = myChart4_2.getDataURL();
        //科室未填报人数排名
        var recentQuarterLocIndex = data.recentQuarterLocIndex
        var datalen4_3 = recentQuarterLocIndex.length
        var dataobj4_3 = []
        for (var i = 0; i < datalen4_3; i++) {
            var row = recentQuarterLocIndex[i]
            var tobj = new Object()
            tobj.value = row.notReportedCount
            tobj.name = row.locName
            dataobj4_3.push(tobj)
        }
        // 按照value值进行降序排序
        dataobj4_3.sort(function(a, b) {
            return b.value - a.value;
        });
        dataobj4_3 = dataobj4_3.slice(0, 10);
        var xdata4_3 = []
        var ydata4_3 = []
        dataobj4_3.forEach(function (item, index) {
            xdata4_3.push(item.name);
            ydata4_3.push(item.value);
        });
        var myChart4_3 = echarts.init(document.getElementById('notReportedLocDataTop5Img'));
        var option4_3= {
            color: ['#2EB7BD', '#3CE1D9', '#FBBACB', '#4695D1'],
            title: {
                text: '科室未填报人数情况',
                left: 'center'
            },
            tooltip: {},
            legend: {},
            xAxis: {
                type: 'category',
                data: xdata4_3
            },
            yAxis: {
                name: '例',
                type: 'value',
                splitLine: {
                    show: true,
                    lineStyle: {
                        color: '#cccccc'
                    }
                }
            },
            series: [{
                name: "",
                type: "bar",
                itemStyle: {
                    normal: {
                        color: function (params) {
                            var index = params.dataIndex
                            //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                            var colorList = ['#5470C6', '#FAC858', '#91CC75', '#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622'];
                            if (params.dataIndex >= colorList.length) {
                                index = params.dataIndex - colorList.length;
                            }
                            return colorList[index]
                        }
                    }
                },
                data: ydata4_3
            }]
        };
        myChart4_3.setOption(option4_3);
        AnalysisReport.notReportedLocDataTop5Img = myChart4_3.getDataURL();
        //自动填报率
        var recentQuarterRatioData = data.recentQuarterRatioData
        var datalen5 = recentQuarterRatioData.length
        var dataobj5 = []
        for (var i = 0; i < datalen5; i++) {
            var row = recentQuarterRatioData[i]
            var tobj = new Object()
            tobj.value = row.aRatio
            tobj.name = row.description
            dataobj5.push(tobj)
        }
        // 按照value值进行降序排序
        dataobj5.sort(function(a, b) {
            return b.value - a.value;
        });
        dataobj5 = dataobj5.slice(0, 10);
        var xdata5 = [], ydata5 = []
        dataobj5.forEach(function (item, index) {
            xdata5.push(item.name);
            ydata5.push(item.value);
        });
        var myChart5 = echarts.init(document.getElementById('recentQuarterRatio'));
        // 指定图表的配置项和数据
        var option5 = {
            title: {
                text: '病种自动填报率分析',
                left: 'center'
            },
            tooltip: {},
            legend: {},
            xAxis: {
                type: 'category',
                data: xdata5
            },
            yAxis: {
                max: 'dataMax'
            },
            series: [
                {
                    type: 'bar',
                    data: ydata5,
                    barMaxWidth: '40px',
                    itemStyle: {
                        normal: {
                            color: function (params) {
                                var index = params.dataIndex
                                //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                                var colorList = ['#5470C6', '#FAC858', '#91CC75', '#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622'];
                                if (params.dataIndex >= colorList.length) {
                                    index = params.dataIndex - colorList.length;
                                }
                                return colorList[index]
                            }
                        }
                    },
                }
            ]
        };
        myChart5.setOption(option5);
        AnalysisReport.recentQuarterRatioData = myChart5.getDataURL();
        //填报用时
        var recentQuarterUseTimeData = data.recentQuarterUseTimeData
        var datalen6 = recentQuarterUseTimeData.length
        var dataobj6 = []
        for (var i = 0; i < datalen6; i++) {
            var row = recentQuarterUseTimeData[i]
            var tobj = new Object()
            tobj.value = row.avgUseTime
            tobj.name = row.description
            dataobj6.push(tobj)
        }
        // 按照value值进行降序排序
        dataobj6.sort(function(a, b) {
            return b.value - a.value;
        });
        dataobj6 = dataobj6.slice(0, 10);
        var xdata6 = [], ydata6 = []
        dataobj6.forEach(function (item, index) {
            xdata6.push(item.name);
            ydata6.push(item.value);
        });
        var myChart6 = echarts.init(document.getElementById('recentQuarterUseTime'));
        // 指定图表的配置项和数据
        var option6 = {
            title: {
                text: '病种填报用时平均分析',
                left: 'center'
            },
            tooltip: {},
            legend: {},
            xAxis: {
                type: 'category',
                data: xdata6
            },
            yAxis: {
                max: 'dataMax'
            },
            series: [
                {
                    type: 'bar',
                    data: ydata6,
                    barMaxWidth: '40px',
                    itemStyle: {
                        normal: {
                            color: function (params) {
                                var index = params.dataIndex
                                //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                                var colorList = ['#5470C6', '#FAC858', '#91CC75', '#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622'];
                                if (params.dataIndex >= colorList.length) {
                                    index = params.dataIndex - colorList.length;
                                }
                                return colorList[index]
                            }
                        }
                    },
                }
            ]
        };
        myChart6.setOption(option6);
        AnalysisReport.recentQuarterUseTimeData = myChart6.getDataURL();


    }, function (data) {
    });
    params.reportType = reportType;
    params.startDate = startDate;
    params.endDate = endDate;
    params.tableYear = tableYear;
    params.quarter = quarter;
    params.office = office;
    params.depart = depart;
    ajax.set(params);
    ajax.start();
}


AnalysisReport.getYearImgData = function(reportType, startDate, endDate, tableYear, quarter, office, depart){

    var params = {};
    var ajax = new $ax(Sys.backendPath + "/analysis/selectYearImgData", function (data) {
        //近五年上报情况
        var recentFiveYearImg = data.recentFiveYearImg
        var datalen1 = recentFiveYearImg.length
        var dataobj1 = []
        for (var i = 0; i < datalen1; i++) {
            var row = recentFiveYearImg[i]
            var tobj = new Object()
            tobj.value = row.count
            tobj.name = row.description
            dataobj1.push(tobj)
        }
        // 按照value值进行降序排序
        dataobj1.sort(function(a, b) {
            return b.value - a.value;
        });

        dataobj1 = dataobj1.slice(0, 10);
        var xdata1 = [], ydata1 = []
        dataobj1.forEach(function (item, index) {
            xdata1.push(item.name);
            ydata1.push(item.value);
        });
        var myChart1 = echarts.init(document.getElementById('recentFiveYearImg'));
        // 指定图表的配置项和数据
        var option1 = {
            title: {
                text: '近两年上报情况',
                left: 'center'
            },
            tooltip: {},
            legend: {},
            xAxis: {
                type: 'category',
                data: xdata1
            },
            yAxis: {
                max: 'dataMax'
            },
            series: [
                {
                    type: 'bar',
                    data: ydata1,
                    barMaxWidth: '40px',
                    itemStyle: {
                        normal: {
                            color: function (params) {
                                var index = params.dataIndex
                                //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                                var colorList = ['#5470C6', '#FAC858', '#91CC75', '#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622'];
                                if (params.dataIndex >= colorList.length) {
                                    index = params.dataIndex - colorList.length;
                                }
                                return colorList[index]
                            }
                        }
                    },
                }
            ]
        };
        myChart1.setOption(option1);
        AnalysisReport.recentFiveYearImgData = myChart1.getDataURL();
        //近一年单病种上报情况
        var recentYearImg = data.recentYearImg
        var xdata2 = [];
        var ydata2 = [];
        for (let i in recentYearImg) {
            xdata2.push(i);
            ydata2.push(recentYearImg[i]);
        }
        var myChart2 = echarts.init(document.getElementById('recentYearImg'));
        // 指定图表的配置项和数据
        var option2 = {
            animation:false,//去延迟加载，解决导出只有点的问题
            title: {
                text: '近一年上报情况'
            },
            tooltip: {},
            legend: {},
            xAxis: {
                data: xdata2,
                axisLine: {
                    lineStyle: {}
                }
            },
            yAxis: {},
            series: [
                {
                    name: '例数',
                    type: 'line',
                    smooth: true,
                    showAllSymbol: true,
                    symbol: 'emptyCircle',
                    symbolSize: 15,
                    itemStyle: {
                        normal: {
                            color: function (params) {
                                var index = params.dataIndex
                                //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                                var colorList = ['#5470C6', '#FAC858', '#91CC75', '#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622'];
                                if (params.dataIndex >= colorList.length) {
                                    index = params.dataIndex - colorList.length;
                                }
                                return colorList[index]
                            }
                        }
                    },
                    data: ydata2,
                    markLine: {
                        data: [{type: 'average', name: '月均上报'}]
                    }
                },

            ]
        };
        myChart2.setOption(option2);
        AnalysisReport.recentYearImgData = myChart2.getDataURL();
        //病种上报情况
        var recentYearUpEntity = data.recentYearUpEntity
        var datalen3 = recentYearUpEntity.length
        var dataobj3 = []
        for (var i = 0; i < datalen3; i++) {
             var row = recentYearUpEntity[i]
             var tobj = new Object()
             tobj.value = row.count
             tobj.name = row.code
             dataobj3.push(tobj)
         }
        // 按照value值进行降序排序
        dataobj3.sort(function(a, b) {
            return b.value - a.value;
        });
        dataobj3=dataobj3.slice(0,10);
        var xdata3 = [], ydata3 = []
        dataobj3.forEach(function (item, index) {
            xdata3.push(item.name);
            ydata3.push(item.value);
        });
        var myChart3 = echarts.init(document.getElementById('recentYearUpEntity'));
        // 指定图表的配置项和数据
        var option3 = {
            title: {
                text: '病种上报情况',
                left: 'center'
            },
            tooltip: {},
            legend: {},
            xAxis: {
                type: 'category',
                data: xdata3
            },
            yAxis: {
                max: 'dataMax'
            },
            series: [
                {
                    type: 'bar',
                    data: ydata3,
                    barMaxWidth: '40px',
                    itemStyle: {
                        normal: {
                            color: function (params) {
                                var index = params.dataIndex
                                //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                                var colorList = ['#5470C6', '#FAC858', '#91CC75', '#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622'];
                                if (params.dataIndex >= colorList.length) {
                                    index = params.dataIndex - colorList.length;
                                }
                                return colorList[index]
                            }
                        }
                    },
                }
            ]
        };
        myChart3.setOption(option3);
        AnalysisReport.recentYearUpEntityData = myChart3.getDataURL();
        //科室上报
        var recentYearUpLoc = data.recentYearUpLoc
        var datalen4 = recentYearUpLoc.length
        var dataobj4 = []
        for (var i = 0; i < datalen4; i++) {
            var row = recentYearUpLoc[i]
            var tobj = new Object()
            tobj.value = row.count
            tobj.name = row.description
            dataobj4.push(tobj)
        }
        // 按照value值进行降序排序
        dataobj4.sort(function(a, b) {
            return b.value - a.value;
        });
        dataobj4 = dataobj4.slice(0, 10);
        var xdata4 = []
        var ydata4 = []
        dataobj4.forEach(function (item, index) {
            xdata4.push(item.name);
            ydata4.push(item.value);
        });
        var myChart4 = echarts.init(document.getElementById('recentYearUpLoc'));
        var option4 = {
            color: ['#2EB7BD', '#3CE1D9', '#FBBACB', '#4695D1'],
            title: {
                text: '科室上报情况',
                left: 'center'
            },
            tooltip: {},
            legend: {},
            xAxis: {
                type: 'category',
                data: xdata4
            },
            yAxis: {
                type: 'value',
                splitLine: {
                    show: true,
                    lineStyle: {
                        color: '#cccccc'
                    }
                }
            },
            series: [{
                name: "",
                type: "bar",
                itemStyle: {
                    normal: {
                        color: function (params) {
                            var index = params.dataIndex
                            //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                            var colorList = ['#5470C6', '#FAC858', '#91CC75', '#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622'];
                            if (params.dataIndex >= colorList.length) {
                                index = params.dataIndex - colorList.length;
                            }
                            return colorList[index]
                        }
                    }
                },
                data: ydata4
            }]
        };
        myChart4.setOption(option4);
        AnalysisReport.recentYearUpLocData = myChart4.getDataURL();
        //科室10日内填报率
        var recentYearLocIndex = data.recentYearLocIndex
        var datalen4_1 = recentYearLocIndex.length
        var dataobj4_1 = []
        for (var i = 0; i < datalen4_1; i++) {
            var row = recentYearLocIndex[i]
            var tobj = new Object()
            tobj.value = row.in10DaysReportedRate
            tobj.name = row.locName
            dataobj4_1.push(tobj)
        }
        // 按照value值进行降序排序
        dataobj4_1.sort(function(a, b) {
            return b.value - a.value;
        });
        dataobj4_1 = dataobj4_1.slice(0, 10);
        var xdata4_1 = []
        var ydata4_1 = []
        dataobj4_1.forEach(function (item, index) {
            xdata4_1.push(item.name);
            ydata4_1.push(item.value);
        });
        var myChart4_1 = echarts.init(document.getElementById('in10DaysReportedLocDataTop5Img'));
        var option4_1 = {
            color: ['#2EB7BD', '#3CE1D9', '#FBBACB', '#4695D1'],
            title: {
                text: '科室10日填报率情况',
                left: 'center'
            },
            tooltip: {},
            legend: {},
            xAxis: {
                type: 'category',
                data: xdata4_1
            },
            yAxis: {
                name: '%',
                type: 'value',
                splitLine: {
                    show: true,
                    lineStyle: {
                        color: '#cccccc'
                    }
                }
            },
            series: [{
                name: "",
                type: "bar",
                itemStyle: {
                    normal: {
                        color: function (params) {
                            var index = params.dataIndex
                            //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                            var colorList = ['#5470C6', '#FAC858', '#91CC75', '#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622'];
                            if (params.dataIndex >= colorList.length) {
                                index = params.dataIndex - colorList.length;
                            }
                            return colorList[index]
                        }
                    }
                },
                data: ydata4_1
            }]
        };
        myChart4_1.setOption(option4_1);
        AnalysisReport.in10DaysReportedLocDataTop5Img = myChart4_1.getDataURL();
        //科室超10日未填报率
        var recentYearLocIndex = data.recentYearLocIndex
        var datalen4_2 = recentYearLocIndex.length
        var dataobj4_2 = []
        for (var i = 0; i < datalen4_2; i++) {
            var row = recentYearLocIndex[i]
            var tobj = new Object()
            tobj.value = row.over10DaysNotReportedRate
            tobj.name = row.locName
            dataobj4_2.push(tobj)
        }
        // 按照value值进行降序排序
        dataobj4_2.sort(function(a, b) {
            return b.value - a.value;
        });
        dataobj4_2 = dataobj4_2.slice(0, 10);
        var xdata4_2 = []
        var ydata4_2 = []
        dataobj4_2.forEach(function (item, index) {
            xdata4_2.push(item.name);
            ydata4_2.push(item.value);
        });
        var myChart4_2 = echarts.init(document.getElementById('over10DaysNotReportedLocDataTop5Img'));
        var option4_2 = {
            color: ['#2EB7BD', '#3CE1D9', '#FBBACB', '#4695D1'],
            title: {
                text: '科室超10日未填报率情况',
                left: 'center'
            },
            tooltip: {},
            legend: {},
            xAxis: {
                type: 'category',
                data: xdata4_2
            },
            yAxis: {
                name: '%',
                type: 'value',
                splitLine: {
                    show: true,
                    lineStyle: {
                        color: '#cccccc'
                    }
                }
            },
            series: [{
                name: "",
                type: "bar",
                itemStyle: {
                    normal: {
                        color: function (params) {
                            var index = params.dataIndex
                            //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                            var colorList = ['#5470C6', '#FAC858', '#91CC75', '#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622'];
                            if (params.dataIndex >= colorList.length) {
                                index = params.dataIndex - colorList.length;
                            }
                            return colorList[index]
                        }
                    }
                },
                data: ydata4_2
            }]
        };
        myChart4_2.setOption(option4_2);
        AnalysisReport.over10DaysNotReportedLocDataTop5Img = myChart4_2.getDataURL();
        //科室未填报人数排名
        var recentYearLocIndex = data.recentYearLocIndex
        var datalen4_3 = recentYearLocIndex.length
        var dataobj4_3 = []
        for (var i = 0; i < datalen4_3; i++) {
            var row = recentYearLocIndex[i]
            var tobj = new Object()
            tobj.value = row.notReportedCount
            tobj.name = row.locName
            dataobj4_3.push(tobj)
        }
        // 按照value值进行降序排序
        dataobj4_3.sort(function(a, b) {
            return b.value - a.value;
        });
        dataobj4_3 = dataobj4_3.slice(0, 10);
        var xdata4_3 = []
        var ydata4_3 = []
        dataobj4_3.forEach(function (item, index) {
            xdata4_3.push(item.name);
            ydata4_3.push(item.value);
        });
        var myChart4_3 = echarts.init(document.getElementById('notReportedLocDataTop5Img'));
        var option4_3= {
            color: ['#2EB7BD', '#3CE1D9', '#FBBACB', '#4695D1'],
            title: {
                text: '科室未填报人数情况',
                left: 'center'
            },
            tooltip: {},
            legend: {},
            xAxis: {
                type: 'category',
                data: xdata4_3
            },
            yAxis: {
                name: '例',
                type: 'value',
                splitLine: {
                    show: true,
                    lineStyle: {
                        color: '#cccccc'
                    }
                }
            },
            series: [{
                name: "",
                type: "bar",
                itemStyle: {
                    normal: {
                        color: function (params) {
                            var index = params.dataIndex
                            //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                            var colorList = ['#5470C6', '#FAC858', '#91CC75', '#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622'];
                            if (params.dataIndex >= colorList.length) {
                                index = params.dataIndex - colorList.length;
                            }
                            return colorList[index]
                        }
                    }
                },
                data: ydata4_3
            }]
        };
        myChart4_3.setOption(option4_3);
        AnalysisReport.notReportedLocDataTop5Img = myChart4_3.getDataURL();
        //自动填报率
        var recentYearRatioData = data.recentYearRatioData
        var datalen5 = recentYearRatioData.length
        var dataobj5 = []
        for (var i = 0; i < datalen5; i++) {
            var row = recentYearRatioData[i]
            var tobj = new Object()
            tobj.value = row.aRatio
            tobj.name = row.description
            dataobj5.push(tobj)
        }
        // 按照value值进行降序排序
        dataobj5.sort(function(a, b) {
            return b.value - a.value;
        });
        dataobj5 = dataobj5.slice(0, 10);
        var xdata5 = [], ydata5 = []
        dataobj5.forEach(function (item, index) {
            xdata5.push(item.name);
            ydata5.push(item.value);
        });
        var myChart5 = echarts.init(document.getElementById('recentYearRatio'));
        // 指定图表的配置项和数据
        var option5 = {
            title: {
                text: '病种自动填报率分析',
                left: 'center'
            },
            tooltip: {},
            legend: {},
            xAxis: {
                type: 'category',
                data: xdata5
            },
            yAxis: {
                max: 'dataMax'
            },
            series: [
                {
                    type: 'bar',
                    data: ydata5,
                    barMaxWidth: '40px',
                    itemStyle: {
                        normal: {
                            color: function (params) {
                                var index = params.dataIndex
                                //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                                var colorList = ['#5470C6', '#FAC858', '#91CC75', '#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622'];
                                if (params.dataIndex >= colorList.length) {
                                    index = params.dataIndex - colorList.length;
                                }
                                return colorList[index]
                            }
                        }
                    },
                }
            ]
        };
        myChart5.setOption(option5);
        AnalysisReport.recentYearRatioData = myChart5.getDataURL();
        //填报用时
        var recentYearUseTimeData = data.recentYearUseTimeData
        var datalen6 = recentYearUseTimeData.length
        var dataobj6 = []
        for (var i = 0; i < datalen6; i++) {
            var row = recentYearUseTimeData[i]
            var tobj = new Object()
            tobj.value = row.avgUseTime
            tobj.name = row.description
            dataobj6.push(tobj)
        }
        // 按照value值进行降序排序
        dataobj6.sort(function(a, b) {
            return b.value - a.value;
        });
        dataobj6 = dataobj6.slice(0, 10);
        var xdata6 = [], ydata6 = []
        dataobj6.forEach(function (item, index) {
            xdata6.push(item.name);
            ydata6.push(item.value);
        });
        var myChart6 = echarts.init(document.getElementById('recentYearUseTime'));
        // 指定图表的配置项和数据
        var option6 = {
            title: {
                text: '病种填报用时平均分析',
                left: 'center'
            },
            tooltip: {},
            legend: {},
            xAxis: {
                type: 'category',
                data: xdata6
            },
            yAxis: {
                max: 'dataMax'
            },
            series: [
                {
                    type: 'bar',
                    data: ydata6,
                    barMaxWidth: '40px',
                    itemStyle: {
                        normal: {
                            color: function (params) {
                                var index = params.dataIndex
                                //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                                var colorList = ['#5470C6', '#FAC858', '#91CC75', '#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622'];
                                if (params.dataIndex >= colorList.length) {
                                    index = params.dataIndex - colorList.length;
                                }
                                return colorList[index]
                            }
                        }
                    },
                }
            ]
        };
        myChart6.setOption(option6);
        AnalysisReport.recentYearUseTimeData = myChart6.getDataURL();


    }, function (data) {
    });
    params.reportType = reportType;
    params.startDate = startDate;
    params.endDate = endDate;
    params.tableYear = tableYear;
    params.quarter = quarter;
    params.office = office;
    params.depart = depart;
    ajax.set(params);
    ajax.start();
}

/**
 * 根据给定参数从Redis获取图表数据。
 * 如果数据在Redis中不存在，则从数据库中获取。
 *
 * @param {string} reportType 报表类型
 * @param {string} startDate 开始日期
 * @param {string} endDate 结束日期
 * @param {number} tableYear 表年份
 * @param {number} quarter 季度
 * @param {string} office 办公室
 * @param {string} depart 部门
 */
AnalysisReport.getImgDataByRedis = function(reportType, startDate, endDate, tableYear, quarter, office, depart){
    var params = {}; // 准备请求参数
    var ajax = new $ax(Sys.backendPath + "/analysis/selectImgDataByRedis", function (data) {
        // 请求成功后的回调函数
        if (data.code==1){
            // Redis中有数据
            AnalysisReport.isRedis=true;
        }else {
            AnalysisReport.isRedis=false;
            // Redis中无数据，从数据库中获取
            switch (reportType) {
                case "1":
                    break;
                case "2":
                    break;
                case "3":
                    AnalysisReport.getYearImgData(reportType, startDate, endDate, tableYear, quarter, office, depart);
                   break;
                case "4":
                    AnalysisReport.getQuarterImgData(reportType, startDate, endDate, tableYear, quarter, office, depart);
                    break
                default:
                    break;
            }

        }
    }, function (data) {
        // 错误处理函数
    });
    params.reportType = reportType;
    params.startDate = startDate;
    params.endDate = endDate;
    params.tableYear = tableYear;
    params.quarter = quarter;
    params.office = office;
    params.depart = depart;
    ajax.set(params); // 设置请求参数
    ajax.start(); // 发起请求
}